'use strict'

const Util = require('../../Lib/Util')
const BaseTable = require('../../BaseClass/BaseTable')
const Database = use('Database')
const log = use('Logger')

class McPricingResultTable extends BaseTable {
  async getPrice(obj) {
    try {
      let result = await Database.select('price')
        .from(this.tabelName)
        .where('index_min', '<=', obj.baseScore)
        .where('index_max', '>', obj.baseScore)

      return Util.end({
        msg: 'OK',
        data: result,
      })
    } catch (err) {
      return Util.error({
        msg: err.message,
        track: 'joipo090',
      })
    }
  }
}

module.exports = McPricingResultTable
